Skip to content

Fall back when IBKR historical data is empty - #106

Merged
Pigbibi merged 1 commit into
mainfrom
fix-ibkr-history-fallback
May 26, 2026
Merged

Fall back when IBKR historical data is empty#106
Pigbibi merged 1 commit into
mainfrom
fix-ibkr-history-fallback

Conversation

@Pigbibi

@Pigbibi Pigbibi commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add yfinance fallback candles when IBKR historical bars return empty or unavailable
  • reuse fallback candles to build close history for strategy prechecks
  • cover fallback close and candle paths in runtime adapter tests

Tests

  • PYTHONPATH=. PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /tmp/ues-test-venv/bin/python -m pytest -q tests/test_runtime_strategy_adapters.py
  • ruff check application/runtime_strategy_adapters.py tests/test_runtime_strategy_adapters.py

Deployment

  • keep Cloud Build as the deployment owner
  • GitHub env-sync remains disabled with ENABLE_GITHUB_ENV_SYNC=false to avoid duplicate revisions and env type conflicts

@Pigbibi
Pigbibi merged commit fbc7b1c into main May 26, 2026
1 check passed
@Pigbibi
Pigbibi deleted the fix-ibkr-history-fallback branch May 26, 2026 19:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5510c3d38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if unit == "D":
if quantity > 365:
return f"{ceil(quantity / 365)}y"
return f"{max(quantity, 1)}d"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Map day durations to valid yfinance periods

The fallback currently converts IBKR day windows to "{N}d" (for example "10 D" becomes "10d"), but yfinance.download(period=...) only accepts a fixed set of period values and rejects arbitrary day counts. In this codebase, _build_historical_close_map calls the loader with duration="10 D", so when IBKR returns no data the yfinance fallback hits an invalid period, gets caught, and silently returns an empty series—defeating the new fallback path for close-history prechecks.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant